package com.runen.infinitemovement.activity;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.os.Bundle;
import android.widget.FrameLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;

import com.runen.infinitemovement.R;
import com.runen.infinitemovement.adapter.IntroduceAdapter;
import com.runen.infinitemovement.base.BaseActivity;
import com.runen.infinitemovement.model.entity.IntroduceEntity;
import com.runen.infinitemovement.model.enums.SPCompat;
import com.runen.infinitemovement.tool.CommonUtil;
import com.runen.infinitemovement.tool.notchtool.NotchTools;
import com.runen.infinitemovement.tool.notchtool.core.NotchProperty;
import com.runen.infinitemovement.tool.notchtool.core.OnNotchCallBack;
import com.runen.rxnetlibrary.utils.SharePreferenceUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Create by LiaoDuanHong
 * Create on
 */
public class IntroduceActivity extends BaseActivity {
    @BindView(R.id.rcv_content)
    RecyclerView rcvContent;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_introduce;
    }

    @Override
    protected void initView(@Nullable Bundle savedInstanceState) {
        ButterKnife.bind(this);
        //适配刘海屏
        NotchTools.getFullScreenTools().translucentStatusBar(this, new OnNotchCallBack() {
            @Override
            public void onNotchPropertyCallback(NotchProperty notchProperty) {
                FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) rcvContent.getLayoutParams();
                layoutParams.setMargins(0,
                        CommonUtil.dp2px(IntroduceActivity.this, 50)
                                + CommonUtil.getStatusBarHeight(IntroduceActivity.this),
                        0, 0);
                rcvContent.setLayoutParams(layoutParams);
            }
        });
//        SharePreferenceUtils.putBoolean(IntroduceActivity.this, SPCompat.FIRST_START_APP, false);
        IntroduceAdapter adapter = new IntroduceAdapter(this);
        LinearLayoutManager llm = new LinearLayoutManager(this);
        llm.setOrientation(LinearLayoutManager.VERTICAL);
        rcvContent.setAdapter(adapter);
        rcvContent.setLayoutManager(llm);
        // 将SnapHelper attach 到RecyclrView
        PagerSnapHelper snapHelper = new PagerSnapHelper();
        snapHelper.attachToRecyclerView(rcvContent);


        List<IntroduceEntity> list = new ArrayList<>();
        list.add(new IntroduceEntity(IntroduceEntity.ONE));
        list.add(new IntroduceEntity(IntroduceEntity.TWO));
        adapter.setNewData(list);
    }


    @Override
    protected boolean isUseFullScreenMode() {
        return true;
    }
}
